package mspbots.cw.business.core.tickets;

import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Mono;

/**
 * @author Jay.Yang
 */
public interface TicketsFlowRepository extends R2dbcRepository<TicketsFlow, Long> {

    @Query("select * from task_cw_ticket_flow where tenant_code =:tenantCode and ticket_id =:ticketId order by updated_time desc limit 1")
    Mono<TicketsFlow> findFlowByTicketIdAndTenantCode(Long ticketId, Long tenantCode);
}
